package com.lpf.方法引用与构造器引用;

import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;

import org.junit.Test;

import com.lpf.common.Employee;

@SuppressWarnings("ALL")
public class ConstructorRef {

	@Test
	public void test1() {
		Function<String, Employee> fun = Employee::new;
		Employee emp = fun.apply("挖坑埋你");
		System.out.println(emp);

		System.out.println("------------------------------------");

		BiFunction<String, Integer, Employee> fun2 = Employee::new;
		Employee emp2 = fun2.apply("挖坑埋你", 25);
		System.out.println(emp2);
	}

	@Test
	public void test2() {
		Supplier<Employee> sup = () -> new Employee();
		System.out.println(sup.get());

		System.out.println("------------------------------------");

		Supplier<Employee> sup2 = Employee::new;
		System.out.println(sup2.get());
	}
}
